package com.zzq.calcgame.entity;

import android.text.TextUtils;

/**
 * 题目
 */
public class Question {
    int id;
    int paperId;//试卷id 外键
    String number1;
    Operator operator;//操作符
    String number2;
    String answer;//用户答案

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getPaperId() {
        return paperId;
    }

    public void setPaperId(int paperId) {
        this.paperId = paperId;
    }

    public String getNumber1() {
        return number1;
    }

    public void setNumber1(String number1) {
        this.number1 = number1;
    }

    public Operator getOperator() {
        return operator;
    }

    public void setOperator(Operator operator) {
        this.operator = operator;
    }

    public String getNumber2() {
        return number2;
    }

    public void setNumber2(String number2) {
        this.number2 = number2;
    }

    public String getAnswer() {
        return TextUtils.isEmpty(answer) ? "0" : answer;
    }

    public void setAnswer(String answer) {
        this.answer = answer;
    }

    @Override
    public String toString() {
        return "Question{" +
                "id=" + id +
                ", paperId=" + paperId +
                ", number1='" + number1 + '\'' +
                ", operator=" + operator.getDescription() +
                ", number2='" + number2 + '\'' +
                ", answer='" + answer + '\'' +
                '}';
    }

}
